﻿@using SAIM.Models.BLL
@using SAIM.Models:

@if (Request.IsAuthenticated)
{
    var userName = string.Empty;
    var userIdentity = new SAIMIdentity(User.Identity);
    using (AspNetUsersBLL user = new AspNetUsersBLL(userIdentity.GetUserId()))
    {
        if (user.isInRole("Services"))
        {
            <li class="dropdown">
                <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Servicios<span class="caret"></span></a>
                <ul class="dropdown-menu multi-level" role="menu" aria-labelledby="dropdownMenu">                    
                    <li class="dropdown-submenu">                                                  
                        <a href="#">Tickets</a>
                        <ul class="dropdown-menu">
                            @if (user.isInRole("Maintenance Tickets") || user.isInRole("RTIC Tickets") || user.isInRole("Administration Tickets"))
                            {
                                <li>@Html.ActionLink("Administrar tickets", "Manage", "Tickets", null, new { @class = "dropdown-link" })</li>
                            }
                            <li>@Html.ActionLink("Mis tickets", "Index", "Tickets", null, new { @class = "dropdown-link" })</li>
                            @if (user.isInRole("Create tickets"))
                            { 
                                <li>@Html.ActionLink("Nuevo ticket", "New", "Tickets", null, new { @class = "dropdown-link" })</li>
                            }
                        </ul>
                    </li>
                    
                    <li class="dropdown-submenu">
                            @if (user.isInRole("Social Service"))
                            {
                                <a href="#">Servicio Social</a>
                                <ul class="dropdown-menu">
                                    <li>@Html.ActionLink("Capturar", "Index", "SocialService", new { @id = "" }, new { @class = "dropdown-link" })</li>
                                    <li>@Html.ActionLink("Consultar", "Manage", "SocialService", null, new { @class = "dropdown-link" })</li>
                                </ul>
                            }
                        
                    </li>

                    



                    
                    @*<li class="dropdown-submenu">
                        <a href="#">Solicitud de Infraestructura</a>
                        <ul class="dropdown-menu">
                            if (user.isInRole("Manage applications"))
                            {
                                <li>@Html.ActionLink("Gestionar solicitudes", "Manage", "Applications", null, new { @class = "dropdown-link" })</li>
                            }
                            <li>@Html.ActionLink("Mis solicitudes", "Index", "Applications", null, new { @class = "dropdown-link" })</li>
                            <li>@Html.ActionLink("Nueva solicitud", "Immovables", "Applications", null, new { @class = "dropdown-link" })</li>
                        </ul>
                    </li>*@
                </ul>
            </li>
        }
        if (user.isInRole("RTIC"))
        {
            <li class="dropdown">
                <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">TIC'S<span class="caret"></span></a>
                <ul class="dropdown-menu multi-level" role="menu" aria-labelledby="dropdownMenu">
                    @if (user.isInRole("Search users"))
                    {
                        <li>@Html.ActionLink("Buscar usuario", "Search", "Users")</li>
                    }
                </ul>
            </li>
        }
        if (user.isInRole("Lists"))
        {
            <li class="dropdown">@Html.ActionLink("Listas", "Lists", "EVirtual")</li>
        }
        <li class="dropdown">@Html.ActionLink("Descargas", "Index", "Downloads")</li>
    }
}
